import { RouteRecordRaw } from "vue-router";
import HomePage from "@/view/HomePage.vue";
import ACCESS_ENUM from "@/access/accessEnum";
import AdminUserPage from "@/view/admin/user/AdminUserPage.vue";
import AdminQuestionPage from "@/view/admin/question/AdminQuestionPage.vue";
import AdminAnswerPage from "@/view/admin/answer/AdminAnswerPage.vue";
import UserLayout from "@/layouts/UserLayout.vue";
import UserLoginPage from "@/view/user/UserLoginPage.vue";
import UserRegisterPage from "@/view/user/UserRegisterPage.vue";
import AdminLayout from "@/layouts/AdminLayout.vue";
import NoAuthPage from "@/view/NoAuthPage.vue";
import AdminScoringResultPage from "@/view/admin/scoringresult/AdminScoringResultPage.vue";
import AdminAppPage from "@/view/admin/app/AdminAppPage.vue";
import AppDetailPage from "@/view/app/AppDetailPage.vue";
import AddAppPage from "@/view/add/AddAppPage.vue";
import AnswerResultPage from "@/view/answer/AnswerResultPage.vue";
import MyAnswerPage from "@/view/answer/MyAnswerPage.vue";
import DoAnswerPage from "@/view/answer/DoAnswerPage.vue";
import AddQuestionPage from "@/view/add/AddQuestionPage.vue";
import AddScoringResultPage from "@/view/add/AddScoringResultPage.vue";
import AppStatisticPage from "@/view/statistic/AppStatisticPage.vue";
import UserInfoPage from "@/view/user/UserInfoPage.vue";
import AddChartPage from "@/view/statistic/AddChartPage.vue";
import MyChartPage from "@/view/statistic/MyChartPage.vue";
import SystemOperationLogView from "@/view/admin/operationlog/SystemOperationLogView.vue";
import WrongQuestionPage from "@/view/answer/WrongQuestionPage.vue";
import KnowledgeGraphPage from "@/view/answer/KnowledgeGraphPage.vue";

export const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "主页",
    component: HomePage, // 首页组件
  },
  {
    path: "/noPath",
    name: "无权限",
    component: NoAuthPage,
    meta: {
      hideInMenu: true,
    },
  },
  {
    path: "/add/app",
    name: "创建应用",
    component: AddAppPage,
  },
  {
    path: "/app_statistic",
    name: "应用统计",
    component: AppStatisticPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/add_chart",
    name: "添加图表",
    component: AddChartPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/my_chart",
    name: "我的图表",
    component: MyChartPage,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/info",
    name: "用户信息",
    component: UserInfoPage,
    meta: {
      hideInMenu: true,
    },
  },
  {
    path: "/add/app/:id",
    name: "修改应用",
    props: true,
    component: AddAppPage,
    meta: {
      hideInMenu: true,
    },
  },
  {
    path: "/add/question/:appId",
    name: "创建题目",
    component: AddQuestionPage,
    props: true,
    meta: {
      hideInMenu: true,
    },
  },
  {
    path: "/add/scoring_result/:appId",
    name: "创建评分",
    component: AddScoringResultPage,
    props: true,
    meta: {
      hideInMenu: true,
    },
  },
  {
    path: "/app/detail/:id",
    name: "应用详情页",
    props: true,
    component: AppDetailPage,
    meta: {
      hideInMenu: true,
    },
  },
  {
    path: "/answer/do/:appId",
    name: "答题",
    component: DoAnswerPage,
    props: true,
    meta: {
      hideInMenu: true,
      access: ACCESS_ENUM.USER,
    },
  },
  {
    path: "/answer/result/:id",
    name: "答题结果",
    component: AnswerResultPage,
    props: true,
    meta: {
      hideInMenu: true,
      access: ACCESS_ENUM.USER,
    },
  },
  {
    path: "/answer/my",
    name: "我的答题",
    component: MyAnswerPage,
    meta: {
      access: ACCESS_ENUM.USER,
    },
  },
  {
    path: "/answer/wrong_questions",
    name: "我的错题",
    component: WrongQuestionPage,
    meta: {
      access: ACCESS_ENUM.USER,
    },
  },
  {
    path: "/answer/knowledge_graph",
    name: "知识图谱",
    component: KnowledgeGraphPage,
    meta: {
      access: ACCESS_ENUM.USER,
    },
  },
  {
    path: "/admin",
    name: "管理页面",
    component: AdminLayout,
    meta: {
      access: ACCESS_ENUM.ADMIN,
      icon: "icon-settings",
    },
    children: [
      {
        path: "/admin/user",
        name: "用户管理",
        component: AdminUserPage,
      },
      {
        path: "/admin/question",
        name: "题目管理",
        component: AdminQuestionPage,
      },
      {
        path: "/admin/scoringresulr",
        name: "评分管理",
        component: AdminScoringResultPage,
      },
      {
        path: "/admin/answer",
        name: "回答管理",
        component: AdminAnswerPage,
      },
      {
        path: "/admin/app",
        name: "应用管理",
        component: AdminAppPage,
      },
      {
        path: "/admin/operation",
        name: "日志管理",
        component: SystemOperationLogView,
      },
    ],
  },
  {
    path: "/hide",
    name: "隐藏页面",
    component: HomePage,
    meta: {
      hideInMenu: true,
    },
  },
  {
    path: "/user",
    name: "用户",
    component: UserLayout,
    children: [
      {
        path: "/user/login",
        name: "用户登录",
        component: UserLoginPage,
      },
      {
        path: "/user/register",
        name: "用户注册",
        component: UserRegisterPage,
      },
    ],
    meta: {
      hideInMenu: true,
    },
  },
];
